package com.tjetc.mapper;

import com.tjetc.domain.Scheduling;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface SchedulingMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Scheduling record);

    int insertSelective(Scheduling record);

    Scheduling selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Scheduling record);

    int updateByPrimaryKey(Scheduling record);

    List<Scheduling> selectByCidAndDate(@Param("cid") Integer cid, @Param("date") String date);

    int updateSubCount(Integer scheduleId);

    int updateAddCount(Integer scheduleId);

    @Update("update scheduling set state = 0 where id=#{scheduleId};")
    int updateStateById(Integer scheduleId);

    Integer selectDoctorConflict(Scheduling scheduling);

    Integer selectAddressConflict(Scheduling scheduling);

    Integer selectIsAlternate(Scheduling scheduling);

    List<Scheduling> selectByDid(Integer did);

    Scheduling selectNowScheduling(Integer did);

    @Select("select scheduling.* from scheduling,rank_record where scheduling.id = rank_record.schedule_id")
    Scheduling selectByRid(Integer rid);

    @Select("select * from scheduling where cid = #{id} ")
    List<Scheduling> selectByCid(Integer id);
}